<%@page import="helpers.StringHelper"%>
<%@page import="models.NewsModel"%>
<%@page import="java.net.URLEncoder"%>
<%@page import="helpers.DateHelper"%>
<%@page import="java.util.ArrayList"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="models.SiteConfigModel"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
SiteConfigModel siteConfig = (SiteConfigModel) request.getAttribute("config");
String image = "";//UrlHelper.getServerUrl(request) + "/blobstore-serve?blob-key=" + siteConfig.getLogo();
String name = (String) request.getAttribute("name");
ArrayList<NewsModel> hot_news = (ArrayList<NewsModel>) request.getAttribute("hot_news");
%>

<jsp:include page="/layouts/header.jsp">
    <jsp:param name="title" value="<%=siteConfig.getTitle()%>" />
    <jsp:param name="description" value="<%=siteConfig.getMetaDescription()%>" />
    <jsp:param name="keywords" value="<%=siteConfig.getMetaKeywords()%>" />
    <jsp:param name="ogsite_name" value="<%=siteConfig.getSiteName()%>" />
    <jsp:param name="ogtitle" value="<%=siteConfig.getTitle()%>" />
    <jsp:param name="ogurl" value="<%=UrlHelper.getServerUrl(request)%>" />
    <jsp:param name="ogimage" value="<%=image %>" />
    <jsp:param name="ogdescription" value="<%=siteConfig.getMetaDescription()%>" />
</jsp:include>
<script type="text/javascript" src="/js/hot_news.js"></script>
			<div class="block-content">
				<!-- NEWS -->
				<div class="column-block">
					<div class="block-column-2">
						<div class="feature-news">
							<% if (hot_news.size() > 0 && hot_news.get(0) != null) { %>
							<!-- 
							<div class="image">
								<a target="_blank" href="/goto?url=<%=URLEncoder.encode(hot_news.get(0).getUrl())%>"><img width="661" height="371" src="<%//=hot_news.get(0).getImage()%>"></a>
							</div>
							 -->
							<div class="title"><a target="_blank" href="/goto?url=<%=URLEncoder.encode(hot_news.get(0).getUrl())%>"><%=hot_news.get(0).getTitle() %></a></div>
							<div class="source"><a href="http://<%=UrlHelper.fomatDomains(hot_news.get(0).getUrl()) %>" target="_blank" class="link"><%=UrlHelper.fomatDomains(hot_news.get(0).getUrl()) %></a></div>
							<div class="preview"><%=StringHelper.cutString(StringHelper.html2text(hot_news.get(0).getDescription()), 50) %>...</div>
							<% } %>
						</div>
						<div class="block-column-1">
							<% for (int i = 2; i < hot_news.size(); i+=3) { %>
							<div class="ordinary-news">
								<!-- 
								<div class="image">
									<a target="_blank" href="/goto?url=<%=URLEncoder.encode(hot_news.get(i).getUrl())%>"><img width="312" height="170" src="<%//=hot_news.get(i).getImage()%>" ></a>
								</div>
								 -->
								<div class="title"><a target="_blank" href="/goto?url=<%=URLEncoder.encode(hot_news.get(i).getUrl())%>"><%=hot_news.get(i).getTitle() %></a></div>
								<div class="source"><a href="http://<%=UrlHelper.fomatDomains(hot_news.get(i).getUrl()) %>" target="_blank" class="link"><%=UrlHelper.fomatDomains(hot_news.get(i).getUrl()) %></a></div>
								<div class="preview"><%=StringHelper.cutString(StringHelper.html2text(hot_news.get(i).getDescription()), 50) %>...</div>
							</div>
							<% } %>
						</div>
						<div class="block-column-1">
							<% for (int i = 3; i < hot_news.size(); i+=3) { %>
							<div class="ordinary-news">
								<!-- 
								<div class="image">
									<a target="_blank" href="/goto?url=<%=URLEncoder.encode(hot_news.get(i).getUrl())%>"><img width="312" height="170" src="<%//=hot_news.get(i).getImage()%>" ></a>
								</div>
								 -->
								<div class="title"><a target="_blank" href="/goto?url=<%=URLEncoder.encode(hot_news.get(i).getUrl())%>"><%=hot_news.get(i).getTitle() %></a></div>
								<div class="source"><a href="http://<%=UrlHelper.fomatDomains(hot_news.get(i).getUrl()) %>" target="_blank" class="link"><%=UrlHelper.fomatDomains(hot_news.get(i).getUrl()) %></a></div>
								<div class="preview"><%=StringHelper.cutString(StringHelper.html2text(hot_news.get(i).getDescription()), 50) %>...</div>
							</div>
							<% } %>
						</div>
					</div>
					<div class="block-column-1">
						<% for (int i = 1; i < hot_news.size(); i+=3) { %>
						<div class="ordinary-news <%=i == 1 ? "top" : "" %>">
							<!-- 
							<div class="image">
								<a target="_blank" href="/goto?url=<%=URLEncoder.encode(hot_news.get(i).getUrl())%>"><img width="312" height="170" src="<%//=hot_news.get(i).getImage()%>" ></a>
							</div>
							 -->
							<div class="title"><a target="_blank" href="/goto?url=<%=URLEncoder.encode(hot_news.get(i).getUrl())%>"><%=hot_news.get(i).getTitle() %></a></div>
							<div class="source"><a href="http://<%=UrlHelper.fomatDomains(hot_news.get(i).getUrl()) %>" target="_blank" class="link"><%=UrlHelper.fomatDomains(hot_news.get(i).getUrl()) %></a></div>
							<div class="preview"><%=StringHelper.cutString(StringHelper.html2text(hot_news.get(i).getDescription()), 50) %>...</div>
						</div>
						<% } %>
					</div>
					<div class="clear"></div>
				</div>
				<!-- END NEWS -->
			</div>

<jsp:include page="/layouts/footer.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>	